Skip to content

fix(plugin-sharing): warn once per boot when a hierarchy scope falls back to owner-only - #35780

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-35172-owner-only-fallback-warn
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-35172-owner-only-fallback-warn

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread
Fixes #35172
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:运维人员在不经命令行启动的运行时里,第一次有人用到上下级可见范围而企业版组件没装时,日志里会出现一条警告,说明这些范围只按本人记录生效;终端用户无感。
  • 为什么做:属于权限可见性排查这条线,替自托管运行时的运维人员解决「为什么每个人只看得到自己的记录」查不到原因的问题。
  • 出错会怎样:最坏是这条警告不出现或多出现几次,访问结果本身不变;可以直接撤回。
  • 要你做什么:无

What changes

SharingService.resolveOwnerScopeIds (plugin-sharing) fails closed to owner-only when a hierarchy scope (own_and_reports, unit, unit_and_below) is asked for and no hierarchy-scope-resolver service is registered. That branch used to log nothing, so only os serve (the CLI line added by #35168) ever said so.

  • The first time that fallback is taken, the service logs one warn (HIERARCHY_RESOLVER_ABSENT_NOTICE), with meta { capability: 'hierarchy-security', provider, scope }. The provider is read from PLATFORM_CAPABILITY_PROVIDERS['hierarchy-security'].package, so it is the same @objectstack/security-enterprise string os validate / os verify / os serve print. The prefix and level match the no-org warning just below it ([sharing] hierarchy scope NOT widened: ..., warn). Per AGENTS.md "Degradation log levels", this is a functional degradation, so warn is the right level.
  • Once per boot. The latch is a boolean on the service instance. The plugin builds exactly one SharingService, in its kernel:ready hook (sharing-plugin.ts), so one instance means one boot. The callers (read filter, write gates, share management, middleware) run per request. The condition belongs to the composition, not to a caller or an object, so a finer key would only repeat the line. The latch is claimed before the log, inside a try, so a throwing logger cannot fail a gate or throw once per request.
  • Only when the fallback is taken. own, org and an unset scope return before the resolver lookup, so an app that never uses a hierarchy scope logs nothing. A registered resolver also logs nothing.
  • The CLI stops claiming silence for this token (patch round 1, claim amendment 7033136082). enterpriseAbsenceConsequence (packages/cli/src/utils/capability-preflight.ts) used to end every enterprise-token sentence with "and no log line says so". A new table, ENTERPRISE_ABSENCE_RUNTIME_NOTICE, maps a token to the opening words of the warning its runtime logs. For hierarchy-security, the sentence now says the runtime logs one warning ([sharing] hierarchy scope NOT widened ...) the first time it falls back. Any token without a row keeps the old clause. I made it a separate table, not a clause folded into ENTERPRISE_ABSENCE_CONSEQUENCE, for two reasons. First, the consequence is what the metadata does and the notice is what the runtime says, and a token can have either without the other. Second, the exported table's type stays unchanged.
  • Logging only. The latch records no verdict: the resolver is still looked up on every call, and the returned ids are unchanged ([me]). check:startup-registry-verdict is green on this tree.

Tests

New top-level describe in src/sharing-service.test.ts (the shared harness file). It has six cases:

  • the notice names the capability, the registry provider and the owner-only consequence;
  • a resolver-less hierarchy scope warns once across two calls (unit_and_below, then own_and_reports) plus a public canManageShares gate, and every call answers ['bob'];
  • a fresh instance, standing for a new boot, warns again;
  • CONTROL: undefined / own / org produce no warn at all;
  • CONTROL: a registered resolver produces no notice and returns its own ids;
  • a throwing logger leaves the answer intact and is called only once.

The plugin-side notice pin also asserts the prefix the CLI quotes.

packages/cli/test/capability-preflight.test.ts gains three pins:

  • every runtime-notice row keys an enterprise-edition registry token;
  • hierarchy-security no longer contains "no log line says so" and names the [sharing] hierarchy scope NOT widened prefix;
  • CONTROL: a generic token still says "no log line says so".

Acceptance notes

  • The round-1 finding (the CLI sentence claiming "no log line says so") is fixed in this PR under the claim amendment.
  • Round 2 (claim amendment 7035179372, head 9c805c664c), comment only: the comment on the unmounted-known-tokens block in packages/cli/src/commands/serve.ts no longer says the owner-only fallback happens "without a word". It now says the runtime logs it once at the first fallback, and that os serve says it at start-up, before any request. Readings on that file: eslint --no-inline-config exit 0; check:doc-authoring, check:issue-citations, check:nul-bytes, check:closed-ceremony-text and check-drift-comment all exit 0.

Verification

Two-minute check: pnpm --filter @objectstack/plugin-sharing exec vitest run --maxWorkers=2 src/sharing-service.test.ts -t "said once per boot" should show 6 passed.

Files to read first: packages/plugins/plugin-sharing/src/sharing-service.ts. The risk hunk is the if (!resolver) branch in resolveOwnerScopeIds.

Round-1 readings are on head e26a7e36bb. Round-0 readings, on 4ae41bb446, are kept below.

Two-minute check (CLI): pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2 test/capability-preflight.test.ts should show 50 passed.

Round 1 (e26a7e3): affected test files, CLI ablation, derived gates
narrowed build (core/types/lint/plugin-sharing closures) + both files, under os-verify-lock:
 test/capability-preflight.test.ts   Tests  50 passed (50)
 src/sharing-service.test.ts         Tests  174 passed (174)
os-verify-lock: VERDICT command-exit 0

ablation: ENTERPRISE_ABSENCE_RUNTIME_NOTICE hierarchy-security row deleted
ablation-replace: ok mutation landed: anchor 1 -> 0, blob deafdf72a5ef -> a609ab686a4c
     x hierarchy-security no longer claims silence: it names the warning the runtime logs
      Tests  1 failed | 49 passed (50)
ablation-replace:   blob after restore  deafdf72a5ef83f34f31955313c1c9260cc9fcba
ablation-replace:   blob at HEAD        deafdf72a5ef83f34f31955313c1c9260cc9fcba

Run reconciliation — 71 derived, 69 run, 2 NOT-MEASURED, 0 UNRUN.

NOT MEASURED: check:dual-build-cjs-loads and check:i18n. Reason: both exit 3 PREREQUISITE NOT MET, for want of a repo-wide build; CI runs both.

Declared narrowing: the full CLI unit tier and pnpm --filter @objectstack/cli typecheck were not run locally. The verify lock was queued for about 75 minutes behind dogfood runs, so the build was narrowed to the closures the two touched test files import. CI Test Core and TypeScript Type Check run the full set.

Round 0 (4ae41bb446):

Package test + typecheck (under os-verify-lock)
 Test Files  75 passed (75)
      Tests  1601 passed (1601)
> tsc --noEmit && tsc --noEmit -p tsconfig.scripts.json && pnpm check:test-typecheck
os-verify-lock: VERDICT command-exit 0
Ablation: latch removed, the once-pin goes red; restored by blob hash
ablation-replace: ok mutation landed: anchor 1 -> 0, blob 865061d0017b -> a7557d5d43f7
     x a hierarchy scope with no resolver warns ONCE across two calls, and still answers owner-only
     x a throwing logger neither fails the gate nor throws again
      Tests  2 failed | 4 passed | 168 skipped (174)
ablation-replace:   blob after restore  865061d0017b1fc8b8636cbf95010cd9727ebfa1
ablation-replace:   blob at HEAD        865061d0017b1fc8b8636cbf95010cd9727ebfa1
Derived gates (dispatch-gates --commands, reconciled with --ran)
Run reconciliation — 67 derived, 65 run, 2 NOT-MEASURED, 0 UNRUN.
dispatch-gates --ran: 67 derived famil(ies) accounted for — 65 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3).

NOT MEASURED: check:dual-build-cjs-loads and check:i18n. Reason: both exit 3, PREREQUISITE NOT MET, because they need a repo-wide build (58+ packages without dist/). CI runs both. As a direct substitute, the rebuilt plugin-sharing dist/index.js (CJS) and dist/index.mjs (ESM) both load and export SharingService. Also run, beyond the derivation: check:startup-registry-verdict exit 0 and check:durability-log-level exit 0.

Not run locally: the full test:repo project (CI Test Core), dogfood (no ! and no narrowing arm), and pnpm lint (CI-owned).


Generated by Claude Code

…back to owner-only

Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/cli, @objectstack/plugin-sharing, touching 8 documentable anchor(s).

⛔ 3 release-owned page(s) name something this change touched. These are read-only:

  • content/docs/releases/v17/17-3.mdx (via SharingService (symbol, a top-level class))
  • content/docs/releases/v18/18-1.mdx (via SharingService (symbol, a top-level class))
  • content/docs/releases/v18/18-3.mdx (via SharingService (symbol, a top-level class))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: os serve (command, 51 pages)
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 49 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 1a21ce93a2f8f95a52955380ab6f296b6ab89db4 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from e4ad1bbcb550876ee8b38f089f02f9697c091337 — the merge of head 9c805c664c8768d9e956724018b664a3977bfeb2 into base 1a21ce93a2f8f95a52955380ab6f296b6ab89db4, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e4ad1bbcb550876ee8b38f089f02f9697c091337 && git checkout e4ad1bbcb550876ee8b38f089f02f9697c091337
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 1a21ce93a2f8f95a52955380ab6f296b6ab89db4 9c805c664c8768d9e956724018b664a3977bfeb2 && git checkout -B drift-repro 1a21ce93a2f8f95a52955380ab6f296b6ab89db4 && git merge --no-ff 9c805c664c8768d9e956724018b664a3977bfeb2

node scripts/docs-audit/affected-docs.mjs --json 1a21ce93a2f8f95a52955380ab6f296b6ab89db4

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 1a21ce93a2f8f95a52955380ab6f296b6ab89db4 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…nstead of claiming silence

Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

Seat check

L1: ACCEPT on code and tests (L1-a, for area d7-B) at head e26a7e36bbc507b7429390b2e6efc27370a79197, read 2026-11-20T09:03Z. One comment edit is owed before landing, as a prose-only delta (below). No L2 is owed:

  • no file is under packages/spec/src/**, and no governed path is touched;
  • the declaration is Clause-②: no, with no (narrowing) arm;
  • the change adds a diagnostic and adds no error code.

Owed before landing: the serve.ts comment this PR makes false

packages/cli/src/commands/serve.ts:5478 gives the start-up advisory's reason as "the sharing layer then fails closed to owner-only without a word". After this PR the runtime says it, once, at the first fallback.

This is the same falsified-silence your amendment 7033136082 fixed in capability-preflight.ts, and the new ENTERPRISE_ABSENCE_RUNTIME_NOTICE docblock states the rule ("a runtime that starts logging adds its row here in the same change, or the CLI goes on claiming a silence the server log contradicts"). The comment is the rationale the next author reads before touching either line, so leave it true when this PR lands.

The fix:

  • a one-clause comment edit: the runtime logs it once at the first fallback, and os serve says it at start-up, before any request;
  • a claim amendment naming serve.ts;
  • a delta L1 on the new head.

The cli patch changeset already covers the package. No code changes and no L2 is owed.

Code

  • Latch (sharing-service.ts, resolveOwnerScopeIds).
    • hierarchyResolverAbsenceNoted is set only on the !resolver branch, after own / org / unset have already returned. It is set before the warn, inside try, so a throwing sink logs once and never fails the gate.
    • The resolver is still looked up on every call, and the return [me] is unchanged, so no answer depends on the latch.
    • One instance per boot holds: sharing-plugin.ts builds the service once, at kernel:ready.
  • Notice.
    • The [sharing] hierarchy scope NOT widened: prefix is the existing no-org line's at sharing-service.ts:2536, so one grep finds both.
    • The provider is PLATFORM_CAPABILITY_PROVIDERS['hierarchy-security'].package, the registry row the CLI names.
    • HIERARCHY_RESOLVER_ABSENT_NOTICE is a module export only. src/index.ts re-exports a named list from sharing-service.js that does not include it, so the package entry is unchanged.
  • CLI (your point 2). ENTERPRISE_ABSENCE_RUNTIME_NOTICE is fine under Clause-②: no.
    • packages/cli's exports are ., ./console, ./hook-body and ./package.json.
    • src/index.ts re-exports command classes, and none of compile / validate / verify / serve re-exports capability-preflight. console.ts and hook-body.ts export only their own utils.
    • So the table is not reachable from any entry. Keeping it separate from ENTERPRISE_ABSENCE_CONSEQUENCE is the right call, for the reason its docblock gives: metadata consequence versus runtime notice.
    • enterpriseAbsenceConsequence keeps the hasOwnProperty lookup for both tables.

Tests and controls

  • Sharing:
    • the notice names the token, the registry provider and owner-only, and opens with the prefix the CLI quotes;
    • two hierarchy calls plus a public canManageShares gate give one notice, with {capability, provider, scope}, and the owner-only answers;
    • a fresh instance says it again;
    • CONTROLS: undefined / own / org and an owner gate log nothing; a registered resolver widens and logs nothing;
    • a throwing logger: two calls give one warn and both answer ['bob'].
  • CLI:
    • every runtime-notice key is an enterprise-edition registry token;
    • hierarchy-security drops "no log line says so" and quotes the prefix;
    • CONTROL: an unrowed token keeps the silence clause.
  • Your point 3. I accept the narrowed local run. CI pinned to this head carries what was skipped: Test Core 10/10 and Type Check · workspace / source gates / consumer gates / debt ledger / TypeScript Type Check are all success.

Prose, sentence by sentence

  • Changeset.
    • The three hierarchy scopes, the resolver service and the capability, provider and fail-closed are all true by the code.
    • "a runtime booted without the CLI gave an operator nothing" holds: the CLI was the only voice before.
    • "once per service instance, which is once per boot, never once per request" holds by the latch and the single construction.
    • "Nothing is logged for an app that never asks for a hierarchy scope, or when a resolver is registered" is pinned.
    • "The answer does not change" is pinned.
    • The CLI bullet matches enterpriseAbsenceConsequence, and "Other enterprise tokens keep their wording" is pinned by the CONTROL.
  • Bumps. Two patch bumps are right.

Gates and routing

  • CI at e26a7e36: 39 success, 18 skipped, none red.
  • After the serve.ts comment edit and its delta L1, check-governed-merges.mjs --pr 35780 decides the landing route.

Generated by Claude Code

… owner-only fallback

Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH

Seat check (delta)

L1: ACCEPT (L1-a, for area d7-B) at head 9c805c664c8768d9e956724018b664a3977bfeb2, read 2026-11-20T09:12Z. This closes the one item 7035158988 owed. No L2 is owed.

  • Condition: CI at this head finishes green. When I read, 21 runs were success, 18 skipped and 15 in progress, with none red.

The delta

git diff e26a7e36 9c805c66 is three comment lines in packages/cli/src/commands/serve.ts. "fails closed to owner-only without a word" becomes "fails closed to owner-only; the runtime logs that once, at the first fallback, which may be long after boot. So say it here too, once at start-up and before any request".

Each clause holds:

  • resolveOwnerScopeIds latches on the first fallback, and the first fallback comes at the first hierarchy-scoped read, so "may be long after boot" is right;
  • the start-up advisory runs in serve before the listener.

The edit also keeps the advisory's own reason true, since it is the earlier, request-independent voice.

  • Claim amendment 2 (7035179372) names serve.ts.
  • No new changeset is owed. The existing cli patch covers the package.

Gates and routing

After CI is green at 9c805c66, check-governed-merges.mjs --pr 35780 decides the landing route.


Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Landing · 2026-11-20T09:31Z · head 9c805c664c8768d9e956724018b664a3977bfeb2

Probe Reading
L1 ACCEPT 7035158988 at e26a7e36bb (code and tests), delta ACCEPT 7035378871 at this head (the serve.ts comment it owed)
L2 Not owed: Clause-②: no with no arm, no packages/spec/src/**, no governed rule text, a diagnostic only (L1)
check-governed-merges.mjs --pr 35780 NOT governed; +221 / −9 ≤ 3000
CI at this head 39 success, 18 skipped, 0 red / pending
K (Affected-set diff base 1a21ce9 → origin/main) 1 (< 15) · no merge=os-regen path · overlap-check clean

State: pr_ready + automerge_enable under the maintainer's standing landing go-ahead (2026-10-30: 「按 pm-dispatch 审过的pr你可以自主落地」). On MERGED, #35172 closes by Fixes.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 09:32
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit d99b746 Nov 20, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35172-owner-only-fallback-warn branch November 20, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runtime: the owner-only fallback for a missing hierarchy-security provider logs nothing outside the CLI

2 participants